// room script file

function room_LeaveBottom()
{
	player.ChangeRoom(room_BattleKotsopolous.RoomNum);
}

function room_AfterFadeIn()
{
	BK.FollowCharacter(player, 15, 1);
	
	if(!mis_IncapacitateFucky.complete)
	{
		if(!mis_ConfrontFucky.complete)
		{
			dMeetFBFactory.Start();
			mis_ConfrontFucky.complete = true;
			
			mis_IncapacitateFucky.available = true;
			mis_IncapacitateFucky.received = true;
		}
		else
		{
			dMeetFBFactory2.Start();
		}
	}
}

function room_LeaveLeft()
{
	if(!mis_IncapacitateFucky.complete)
	{
		Display("Hold on! If you walk any farther, that Scottish pirate-looking guy will drop Chief Justice into the acid!");
		player.Walk(Room.LeftEdge+1, player.y, eBlock);
	}
}

function hCageControl_Look()
{
	if(mis_IncapacitateFucky.complete)
	{
		player.Walk(80, 150, eBlock, eWalkableAreas);
		Display("It's the control panel for this cage imprisoning your horse. It doesn't seem to be locked, so opening this cage will be easy.");
	}
}

function CageControl_Interact()
{
	if(mis_IncapacitateFucky.complete && mis_FreeTheRocketHorse.received)
	{
		mis_FreeTheRocketHorse.complete = true;
		mis_AskTheRocketHorseCatchCJ.available = true;
		mis_AskTheRocketHorseCatchCJ.received = true;
		player.Walk(80, 150, eBlock, eWalkableAreas);
		oCage.Graphic = 50;
	}
}

function hRope_UseInv()
{
	if(mis_SaveCJ.received)
	{
		if(mis_AskTheRocketHorseCatchCJ.complete && (player.ActiveInventory == iSpear))
		{
			Display("Shazam! The rope has been cut! You got a billion points!");
			Display("Now to witness the poetic, aerobatic ballet that is a Rocket Horse Rescue!");
			
			CJ.Move(CJ.x, CJ.y+10, eNoBlock, eAnywhere);
			TheRocketHorse.Move(CJ.x, CJ.y, eBlock, eAnywhere);
			
			CJ.ChangeView(VCJ);
			CJ.FollowCharacter(TheRocketHorse, FOLLOW_EXACTLY, 1);
			TheRocketHorse.Walk((player.x+20), player.y, eBlock, eAnywhere);
			CJ.FollowCharacter(null);
			
			TheRocketHorse.FollowCharacter(player, 10, 2);
			CJ.FollowCharacter(player, 20, 2);
			
			Display("Rocket Horse saved the day. He saved his Rocket Horse and rescued Chief Justice!");
			Display("RRRROCKET HORSE!!!!");
			player.ChangeRoom(room_EndScreen.RoomNum);
		}
		else
		if(player.ActiveInventory == iHat)
		{
			Display("Well look at you, trying to cut a rope with a hat. Wow.");
		}
		else
		if(player.ActiveInventory == iChekhovsGun)
		{
			Display("The game is almost done. The gun can't be used here... but any time now... Maybe.");
		}
		else
		if(player.ActiveInventory == iMap)
		{
			Display("The map points to your brain and suggests that you use it.");
		}
		else
		if(player.ActiveInventory == iCard)
		{
			Display("John Renegade can't help you now, what with you having his map and all.");
		}
	}
}